﻿@page
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.Account.Localization
@using Volo.Abp.Account.Settings
@using Volo.Abp.Settings
@model Volo.Abp.Account.Web.Pages.Account.LoginModel
@inject IHtmlLocalizer<AccountResource> L
@inject Volo.Abp.Settings.ISettingProvider SettingProvider

<!-- icheck bootstrap -->
<link rel="stylesheet" href="~/plugins/icheck-bootstrap/icheck-bootstrap.css">



@if (Model.EnableLocalLogin)
{
    <p class="login-box-msg">@L["Login"]</p>

    @if (await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled))
    {
        <p>
            <strong>
                @L["AreYouANewUser"]
                <a href="@Url.Page("./Register", new {returnUrl = Model.ReturnUrl, returnUrlHash = Model.ReturnUrlHash})" class="text-decoration-none">@L["Register"]</a>
            </strong>
        </p>
    }

    <form method="post">
        <input asp-for="ReturnUrl" />
        <input asp-for="ReturnUrlHash" />
        <div class="input-group mb-3">
            <input asp-for="LoginInput.UserNameOrEmailAddress" class="form-control" placeholder="@L["UserNameOrEmailAddress"]">
            <div class="input-group-append">
                <div class="input-group-text">
                    <span class="fas fa-envelope"></span>
                </div>
            </div>
            <span asp-validation-for="LoginInput.UserNameOrEmailAddress" class="text-danger"></span>
        </div>
        <div class="input-group mb-3">
            <input asp-for="LoginInput.Password" class="form-control" placeholder="@L["Password"]">
            <div class="input-group-append">
                <div class="input-group-text">
                    <span class="fas fa-lock"></span>
                </div>
            </div>
            <span asp-validation-for="LoginInput.Password" class="text-danger"></span>
        </div>
        <div class="row">
            <div class="col-8">
                <div class="icheck-primary">
                    <input type="checkbox" id="remember">
                    <label for="remember">
                        @L["RememberMe"]
                    </label>
                </div>
            </div>
            <!-- /.col -->
            <div class="col-4">
                <abp-button type="submit" button-type="Primary" name="Action" value="Login" class="btn btn-primary btn-block">@L["Login"]</abp-button>
            </div>
            <!-- /.col -->
        </div>

    </form>

    @*<div class="social-auth-links text-center mb-3">
            <p>- OR -</p>
            <a href="#" class="btn btn-block btn-primary">
                <i class="fab fa-facebook mr-2"></i> Sign in using Facebook
            </a>
            <a href="#" class="btn btn-block btn-danger">
                <i class="fab fa-google-plus mr-2"></i> Sign in using Google+
            </a>
        </div>*@
    <!-- /.social-auth-links -->

    <p class="mb-1">
        <a href="@Url.Page("./ForgotPassword", new {returnUrl = Model.ReturnUrl, returnUrlHash = Model.ReturnUrlHash})">@L["ForgotPassword"]</a>
    </p>

    @if (Model.VisibleExternalProviders.Any())
    {
        <div class="col-md-6">
            <h4>@L["UseAnotherServiceToLogIn"]</h4>
            <form asp-page="./Login" asp-page-handler="ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" asp-route-returnUrlHash="@Model.ReturnUrlHash" method="post">
                <input asp-for="ReturnUrl" />
                <input asp-for="ReturnUrlHash" />
                @foreach (var provider in Model.VisibleExternalProviders)
                {
                    <button type="submit" class="btn btn-primary" name="provider" value="@provider.AuthenticationScheme" title="@L["GivenTenantIsNotAvailable", provider.DisplayName]">@provider.DisplayName</button>
                }
            </form>
        </div>
    }

    @if (!Model.EnableLocalLogin && !Model.VisibleExternalProviders.Any())
    {
        <div class="alert alert-warning">
            <strong>@L["InvalidLoginRequest"]</strong>
            @L["ThereAreNoLoginSchemesConfiguredForThisClient"]
        </div>
    }

}

